package com.yboot.module.quartz.service;

import com.yboot.module.business.common.exception.job.TaskException;
import com.yboot.module.quartz.model.dto.SysJobDto;
import com.yboot.module.quartz.model.entity.SysJobEntity;
import com.yboot.module.quartz.model.query.SysJobQuery;
import com.yboot.module.quartz.model.vo.SysJobDetailVo;
import com.yboot.module.quartz.model.vo.SysJobVo;
import com.yboot.starter.mybatis.core.base.service.IBaseService;
import org.quartz.SchedulerException;

import java.util.List;

/**
 * 定时任务调度表
 * @author yangcs
 * @date 2025-08-29
 */
public interface ISysJobService  extends IBaseService<SysJobEntity, SysJobVo, SysJobDetailVo, SysJobQuery, SysJobDto> {

    /**
     * 暂停任务
     */
    public boolean pauseJob(String jobId) throws SchedulerException;

    /**
     * 恢复任务
     */
    public boolean resumeJob(String jobId) throws SchedulerException;

    /**
     * 任务调度状态修改
     *
     * @param job 调度信息
     * @return 结果
     */
    public boolean changeStatus(SysJobEntity job) throws SchedulerException;

    /**
     * 立即运行任务
     *
     * @return 结果
     */
    public boolean run(String jobId) throws SchedulerException;

    /**
     * 校验cron表达式是否有效
     *
     * @param cronExpression 表达式
     * @return 结果
     */
    public boolean checkCronExpressionIsValid(String cronExpression);
}
